home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Taifun
/
Taifun 155 (1991-03-10)(Manewaldt, A.)(DE)(PD).zip
/
Taifun 155 (1991-03-10)(Manewaldt, A.)(DE)(PD).adf
/
IFF-Lader
/
IFFInfo.asm
< prev
next >
Wrap
Assembly Source File
|
1991-03-01
|
7KB
|
328 lines
* IFFInfo V1.0
* E.Hambuch
* Darf nicht veraendert werden
include 'exec.i'
include 'dos.i'
include 'startup.i'
_main:
tst.l _WBenchMsg ;from Workbench
bne.s startall ;Ja
clr.b -1(a0,d0.w) ;Parameter von CLI
move.l a0,ParaPtr
startall: ;Libs oeffnen
lea dosname,a1
CALLEXEC OldOpenLibrary
move.l d0,_DOSBase
beq ende
tst.l _WBenchMsg
beq nowb
move.l _WBenchMsg,a0
cmp.b #2,31(a0) ;NumArgs
bne closedos ;kein 2.Icon angeklickt
move.l $24(a0),a0
move.l 8(a0),d1 ;Dir von Iff-Datei
move.l 12(a0),ParaPtr ;Name von Iff-Datei
; 0(a0) Dir von IffInfo
; 4(a0) Name von IffInfo
move.l _DOSBase,a6
jsr _LVOCurrentDir(a6) ;Verzeichnis setzen
move.l #cliwindow,d1
move.l #MODE_OLDFILE,d2
jsr _LVOOpen(a6) ;Fenster oeffnen
move.l d0,Out
bra.s wb2
nowb
CALLDOS Output
move.l d0,Out
wb2:
beq closedos ;Kein Output ?
lea text1,a0
bsr print
move.l ParaPtr,d1 ;Datei oeffnen
move.l #MODE_OLDFILE,d2
jsr _LVOOpen(a6)
move.l d0,File
bne.s w1
lea text2,a0 ;Fehler
bsr print
bra closewin
w1:
move.l File,d1
move.l #buffer,d2
moveq.l #12,d3
jsr _LVORead(a6) ;12 Bytes lesen
cmp.l #'FORM',buffer ;Iff ?
beq.s w2
lea text3,a0 ;Nein
bsr print
bra closefile
w2:
lea buffer,a0
lea IffType,a1
addq.l #8,a0
bsr copyname ;Type ausgeben
move.l File,d1
move.l #buffer,d2
moveq.l #28,d3
jsr _LVORead(a6)
lea buffer,a0
cmp.l #'BMHD',(a0) ;BMHD muss !! direkt nach FORM/ILBm kommen
beq.s w3
lea text3,a0 ;Wenn nicht -> Fehler
bsr print
bra closefile
w3:
lea buffer,a4 ;Werte von BMHD ausgeben
addq.l #8,a4
move.w (a4),d3 ;Wert in d3
lea pWidth,a0 ;Buffer in a0
bsr _dez ; umwandeln
move.w 2(a4),d3
lea pHeight,a0
bsr _dez
move.w 4(a4),d3
lea xpos,a0
bsr _dez
move.w 6(a4),d3
lea ypos,a0
bsr _dez
move.b 8(a4),d0
lea depth,a0
bsr dez22
move.b 8(a4),d1
moveq #0,d0
bset d1,d0
lea maxcols,a0
bsr dez22
move.b 9(a4),d0
lea mask,a0
bsr dez22
move.b 10(a4),d0
lea comp,a0
bsr dez22
move.w 12(a4),d3
lea transc,a0
bsr _dez
move.b 14(a4),d0
lea xas,a0
bsr dez22
move.b 15(a4),d0
lea yas,a0
bsr dez22
move.w 16(a4),d3
lea scrWidth,a0
bsr _dez
move.w 18(a4),d3
lea scrHeight,a0
bsr _dez
lea text4,a0
bsr print
lea chunktxt,a0 ;ausgeben
bsr print
chunkloop: ;uebrige chunks bearbeiten
move.l File,d1
move.l #buffer,d2
moveq #8,d3
jsr _LVORead(a6)
tst.l d0
bls closefile ;Fileende -> Ende
lea buffer,a0
move.l 4(a0),ChunkLen
move.b #'/',4(a0)
clr.b 5(a0)
bsr print ;ausgeben
cmp.l #'CAMG',buffer ;ViewPort-Modus (CAMG) ?
bne cweiter
move.l File,d1
move.l #buffer,d2
move.l ChunkLen,d3
jsr _LVORead(a6)
move.l buffer,ViewMode
bra chunkloop
cweiter:
cmp.l #'BODY',buffer ;BODY ? -> Ende
beq.s endchunk
move.l ChunkLen,-(sp)
readloop: ;Rest lesen
move.l File,d1
move.l #buffer,d2
moveq #1,d3
jsr _LVORead(a6)
tst.l d0
bls.s endchunk
subq.l #1,ChunkLen
bne readloop
off: move.l (sp)+,d0
btst #0,d0 ;ungerade ?
beq chunkloop ;nein
move.l File,d1
move.l #buffer,d2
moveq #1,d3
jsr _LVORead(a6)
bra chunkloop
endchunk:
lea backspc,a0
bsr print
lea text5,a0
bsr print
move.l ViewMode,d5
beq islores
lea ViewTable,a4 ;ViewMode ausgeben
seekview:
move.l (a4)+,a2
move.w (a4)+,d1
bmi.s endview
btst d1,d5
beq.s seekview
move.l a2,a0
bsr print
bra.s seekview
endview:
lea backspc,a0
bsr.s print
lea lf,a0
bsr print
bra.s closefile
islores:
lea view_lores,a0
bsr print
closefile:
move.l File,d1
CALLDOS Close
closewin:
tst.l _WBenchMsg ;bei wbstart fenster schliessen
beq.s closedos
move.l Out,d1 ;Warte auf <return>
move.l #buffer,d2
moveq #2,d3
jsr _LVORead(A6)
move.l Out,d1
jsr _LVOClose(A6)
closedos:
move.l _DOSBase,a1
CALLEXEC CloseLibrary
ende: rts
print: ;Text ausgeben muss mit $00 beendet sein !
move.l a0,a1
l00: tst.b (a1)+
bne.s l00
suba.l a0,a1
move.l Out,d1
move.l a0,d2
move.l a1,d3
subq.l #1,d3
jmp _LVOWrite(a6)
copyname:
move.b (a0)+,(a1)+
move.b (a0)+,(a1)+
move.b (a0)+,(a1)+
move.b (a0)+,(a1)+
rts
_dez: ;Word in d3 -> (a0)
lea _deztab,a1
moveq #0,d1
_dez2: moveq #'0'-1,d2
move.l d1,d4
lsl.l #2,d4
_dez3: addq.b #1,d2
move.l d3,d5
sub.l 0(a1,d4.w),d3
bcc _dez3
move.l d5,d3
move.b d2,0(a0,d1.w)
addq.b #1,d1
cmp.b #5,d1
bne _dez2
rts
_deztab:
dc.l 10000
dc.l 1000
dc.l 100
dc.l 10
dc.l 1
dez22: ;Byte in d0 -> (a0)
moveq #0,d1
move.b d0,d1
divu #10,d1
add.b #'0',d1
move.b d1,(a0)+
swap d1
add.b #'0',d1
move.b d1,(a0)
rts
cliwindow: dc.b 'CON:0/0/640/200/'
dc.b 'IFFInfo V1.0 by E.Hambuch'
dc.b 0
dosname: DOSNAME
_DOSBase: dc.l 0
File: dc.l 0
Out: dc.l 0
ParaPtr: dc.l 0
ChunkLen: dc.l 0
ViewMode: dc.l 0
ViewTable:
dc.l view_lace
dc.w 2
dc.l view_ehb
dc.w 7
dc.l view_ham
dc.w 11
dc.l view_sprites
dc.w 14
dc.l view_hires
dc.w 15
dc.l 0
dc.w -1
view_lace: dc.b 'LACE|',0
view_ehb: dc.b 'EXTRAHALFBRITE|',0
view_ham: dc.b 'HAM|',0
view_sprites: dc.b 'SPRITES|',0
view_hires: dc.b 'HIRES|',0
view_lores: dc.b 'LORES',10,0
text1:
dc.b 'IFFInfo V1.0 by E.Hambuch',10
dc.b '-------------------------',10,0
text2:
dc.b 'Cant open file !',10
dc.b ' USAGE: IFFInfo <File>',10,0
text3:
dc.b 'Error in IFF',10,0
text4:
dc.b 'Iff-Type: '
IffType: dc.b '----',10
dc.b 'BMHD-Chunk:',10
dc.b 'picWidth: '
pWidth: dc.b '00000',10
dc.b 'picHeight: '
pHeight: dc.b '00000',10
dc.b 'X-Position: '
xpos: dc.b '00000',10
dc.b 'Y-Position: '
ypos: dc.b '00000',10
dc.b 'Depth: '
depth: dc.b '00',10
dc.b 'Max.Colors: '
maxcols: dc.b '00',10
dc.b 'Masking: '
mask: dc.b '00',10
dc.b 'Compression: '
comp: dc.b '00',10
dc.b 'TransColor: '
transc: dc.b '00000',10
dc.b 'xAspect: '
xas: dc.b '00',10
dc.b 'yAspect: '
yas: dc.b '00',10
dc.b 'scrWidth: '
scrWidth: dc.b '00000',10
dc.b 'scrHeight: '
scrHeight: dc.b '00000',10
dc.b 0
chunktxt: dc.b 'Chunk(s): ',0
text5: dc.b 10,'ViewMode: '
backspc: dc.b 27,8,32,0,10,0
lf: dc.b 10,0
EVEN
buffer: ds.b 30
end